package com.lagou.cl.redislagouindex.controller;

import com.lagou.cl.redislagouindex.pojo.Position;
import com.lagou.cl.redislagouindex.service.PositionService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 程  林
 * @date 2020-09-20 15:58
 * @description //
 * @since V1.0.0
 */
@RestController
@RequestMapping("/position")
public class PositionController {


	@Autowired
	private PositionService positionService;

	@RequestMapping("getPositions")
	public List<Position> getPositions(String name) {
		if (StringUtils.isBlank(name)) {
			return positionService.queryPositionByAll();
		} else {
			return positionService.queryPositionByName(name);
		}
	}
}
